#include<iostream>
#include<string>
using namespace std;
class television{
	private:
		static int TV_num;
		static int DVD_num;	
		int volume; //音量 
		int type;
		int channel ;//频道 
	public:
		television(){}
		television(int v,int t,int c):volume(v),type(t),channel(c){	}
		void set(int v,int t,int c){
			volume=v;
			type=t;
			channel=c;
		}
		friend void remote_control(television &p,int type,int volume,int channel);
		static void setDVD_num(int n){	DVD_num+=n;		}
		static void setTV_num(int n){	TV_num+=n;		}
		void print(){
			if(type==1)
			cout<<"TV模式";
			else
			cout<<"DVD模式";
			cout<<"--频道"<<channel<<"--音量"<<volume<<endl; 
		}
		static int getTV_num(){ return TV_num;	}
		static int getDVD_num(){ return DVD_num;	}
};		
int television::DVD_num=0;
int television::TV_num=0;
void remote_control(television &p,int type,int volume,int channel){
	if(p.type==2&&type==1){		//在当前模式和切换模式不同时，才需要更改静态数据TV数量 
		television::setDVD_num(-1);
		television::setTV_num(1);
	}
	if(p.type==1&&type==2){		//在当前模式和切换模式不同时，才需要更改静态数据DVD数量 
		television::setDVD_num(1);
		television::setTV_num(-1);
	}
	p.type=type;
	p.channel=channel;
	int i=1; 	//判断是否进行音量变换 
	if(p.volume+volume>=0&&p.volume+volume<=100){
		p.volume+=volume;
		i=0; 
	} 
	if(i&&p.volume+volume<0){
		p.volume=0;
		i=0;
	}
	if(i&&p.volume+volume>100)
		p.volume=100;	
}
int main(){
	int n,t,num,volume,type,channel;
	cin>>n;
	television *t1=new television[n];
	for(int i=0;i<n;i++){
		t1[i].set(50,1,0);	//题目没说TV的初始频道是多少就写0了 
	}
	television::setTV_num(n);	
	cin>>t;
	while(t--){
		cin>>num>>type>>channel>>volume;
		remote_control(t1[num-1],type,volume,channel);
		cout<<"第"<<num<<"号电视机--";
		t1[num-1].print(); 
	}
	cout<<"播放电视的电视机数量为"<<television::getTV_num()<<endl;
	cout<<"播放DVD的电视机数量为"<<television::getDVD_num()<<endl;
}

